package com.example.winner.simpleplay;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button bt1=(Button)findViewById(R.id.start);
        bt1.setOnClickListener(StartIt);
        Button bt2=(Button)findViewById(R.id.stop);
        bt2.setOnClickListener(StopIt);
    }
    private OnClickListener StartIt =new OnClickListener()
    {
        public void onClick(View view)
        {
            startService(new Intent(MainActivity.this,Music.class));
        }
    };
    private OnClickListener StopIt =new OnClickListener()
    {
        public void onClick(View view)
        {
            stopService(new Intent(MainActivity.this,Music.class));
            finish();
        }
    };
}
